//过滤器作业
<template>
  <div>
    <p>国内网站：粉丝数量：{{num | formatNum(10000)}}万</p>
    <p>国外网站：粉丝数量：{{num | formatNum(1000)}}千</p>
    <p>{{timer | formatTime('-')}}</p>
    <p>{{timer | formatTime('/')}}</p>
  </div>
</template>

<script>
export default {
  data () {
    return {
      num: 1876986,
      timer: 1636456028781
    }
  },

  created () {},

  methods: {},

  filters: {
    formatNum (n, multiple) {
      return n / multiple
    },
    formatTime (t, str) {
      const nd = new Date(t)
      var y = nd.getFullYear()
      var mm = (nd.getMonth() + 1).toString().padStart(2, '0')
      var d = nd
        .getDate()
        .toString()
        .padStart(2, '0')
      return y + str + mm + str + d
    }
  }
}
</script>

<style scoped lang='less'>
</style>
